package ACM.red;

/**
 * @Author wwk
 * @DATE 2022/8/28 17:33
 */
import java.util.*;

public class third2 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();  //员工数量
        int[][] relations = new int[n+1][n+1];  //关系无向图
        for (int i = 1; i < n; i++){
            int i1 = scanner.nextInt();
            relations[i1][i+1] = 1;
            relations[i+1][i1] = 1;
        }
        int res = 0;
        int[] p = new int[n+1];
        for (int i = 1; i <=n; i++) {
            if(match(i,n,p,relations,new boolean[n+1])){
                res++;
            }
        }
        System.out.println(res/2);
    }

    static boolean match(int i, int n, int[] p, int[][] relations, boolean[] used){
        for (int j = 1; j <= n ; j++) {
            if(relations[i][j]==1 && !used[j])
            used[j] = true;
            if(p[j]==0||match(p[j],n,p,relations,used)){
                p[j] = i;
                return true;
            }

        }
        return false;
    }

}
